import Axios from 'axios'

const axios = Axios.create({
    timeout:30000,
    baseURL:"/sv"
})

axios.interceptors.request.use(config=>{
    var token = sessionStorage.getItem("token")
    if(token){
        config.headers.token = token
    }
    return config
})

const server = {

    user:{
        login(entity){
            return axios.post('/login',entity);
        },
        sendEmail(email){
            return axios.post('/sendEmail',{email:email});
        },
        getUserInfo(){
            return axios.get('/getUserInfo');
        },
        setUserName(name){
            return axios.post('/setUserInfo',{name:name});
        }
    },
    
    
}

export default server